<?php
function userinformation($userid){

	$power=0;
	if($_SESSION['userid']==$userid)
	{
		$power=1;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
	<title>人员管理系统</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../views/css/re.css">
	<link rel="stylesheet" type="text/css" href="../views/css/index.css">
	<script type="text/javascript" src="../views/js/index.js?v=1"></script>
</head>
<body>
	<div class="body">
	<!--显示所有用户-->
	<div class"userinfo">
		<div class="topic">详细信息：</div>
		<table>
			<form action="updateuser.php" method="post">
		<?php
		$userinfo=getdataall('usertable','userid',$userid);
		if($userinfo)
		{
			foreach ($userinfo as $key => $value) {
				if(!is_numeric($key)&&$key!='password'&&$key!='power')
				{
					$itemname=getdatafcc('column_comment','information_schema.columns','table_name','usertable','column_name',$key); 
					if($key=='classid')
					{
						$value=getdataf('classname','class','classid',$value);
					}
					else if($key=='duty')
					{
						$value=getdataf('dutyname','dutytable','duty',$value);
					}
					?>
					<tr>
						<td><?php echo $itemname[0]; ?></td>
						<td class="messeage"><?php echo $value; ?></td>
						<?php
						if($power==1)
						{
							if($key!='userid'&&$key!='classid'&&$key!='duty')
							{
								?>
								<td class="updatem">
								<?php echo "<input name=\"".$key."\" type=\"text\" value=\"".$value."\">"; ?>
								</td>
								<?php
							}
							else
							{
								if($key=='userid')
								{			
									echo "<input name=\"".$key."\" type=\"hidden\" value=\"".$value."\">";
								}
								?>
								<td class="updatem"><?php echo $value; ?></td>
								<?php 
							}
						}
							
							?>
					</tr>
					<?php
				}
				
			}


		
		}
		else
		{
			echo "不存在该用户";
		}
		
		?>
		</table>
		<?php if($power==1){ ?>
			<div class="messeage">
			<?php
				echo "<input type='button' class='button' value='修改资料' onclick=\"changemodel()\"/>";
			?>
			</div>
			<div class="updatem">
			<?php
				echo "<input type='submit' class='button' value='保存' />";
				echo "<input type='button' class='button' value='取消' onclick=\"changemodel2()\"/>"; 
			?>
			</div>
			<?php } ?>
		</form>

	</div>
</div>

</body>
</html>
<?php
}

?>

